package com.snailwu.security;

import org.bouncycastle.jce.provider.BouncyCastleProvider;

import java.security.Security;
import java.util.Set;

/**
 * JDK 支持的加解密算法:
 * 官方文档：https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html
 *
 * @author WuQinglong
 */
public class SupportAlgorithms {

    /**
     * 获取标准命名的加密算法
     * @param type Standard Names
     */
    public static void print(String type) {
        // 添加三方算法
//        Security.addProvider(new BouncyCastleProvider());

        System.out.println("Standard Names：" + type);
        Set<String> messageDigest = Security.getAlgorithms(type);
        messageDigest.stream().sorted().forEach(System.out::println);
    }

    public static void main(String[] args) {
        print(StandardNames.Cipher);
    }

}
